import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
    {
    path:'/',
    redirect:'/home'
    },
   {
    path:'/home',
    component:()=>import('../pages/home/HomeIndex.vue'),
    children:[
      {
        path:'/home',
        redirect:'/home/data'
      },
      {
        path:'/home/data',
        component:()=>import('../pages/home/data/DataIndex.vue'),
        children:[
          {
            path:'/home/data',
            redirect:'/home/data/basedata'
          },
          {
            path:'/home/data/basedata',
            component:()=>import('../pages/home/data/basedata/BasedataIndex.vue')
          },
          {
            path:'/home/data/customer', 
            component:()=>import('../pages/home/data/customer/CustomerIndex.vue')
          }
        ]
      },
      // indent订单管理
      {
        path:'/home/indent',
        component:()=>import('../pages/home/indent/IndentIndex.vue'),
        children:[
        //这里重定向要加home,否则无效
        {
          path:"/home/indent",
          redirect:'/home/indent/allindents'
        },
          {
            path:'/home/indent/allindents',
            component:()=>import('../pages/home/indent/allindents/AllOrdersIndex.vue')
          },
          {
            path:'/home/indent/waitpay',
            component:()=>import('../pages/home/indent/waitpay/WaitPayIndex.vue')
          }
        ]
      },     
      { 
        path:'/home/commodity',   
        component:()=>import('../pages/home/commodity/CommodityIndex.vue'),
        children:[
          {
            path:"/home/commodity",
            redirect:'/home/commodity/bbb'
          },
          {
            path:'/home/commodity/append',
            component:()=>import('../pages/home/commodity/append/AppendIndex.vue')
          },
          {
            path:'/home/commodity/bbb',
            component:()=>import('../pages/home/commodity/bbbb/BbIndex.vue')
          },
        ]
      },
      {
        path:'/home/promotion',
        component:()=>import('../pages/home/promotion/PromotionIndex.vue'),
        children:[
          {
            path:'/home/promotion',
            redirect:'/home/promotion/huodong'
          },
          {
            path:'/home/promotion/huodong',
            component:()=>import('../pages/home/promotion/components/HuodongIndex.vue'),
          },
          {
            path:'/home/promotion/discounts',
            component:()=>import('../pages/home/promotion/components/DiscountsIndex.vue')
          },
          {
            path:'/home/promotion/iconshow',
            component:()=>import('../pages/home/promotion/components/IconshowIndex.vue')
          },
        ]
      },  
      // 商品新增

    ]
   },
   {
    path:'/login',
    component:()=>import('../pages/login/LoginIndex.vue'),
   },
   {
    path:'/forget',
    component:()=>import('../pages/forget/LoginForget.vue'),
   },
   
  
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
